﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for cls_tbNHANVIEN_CANBOXETDUYET
/// </summary>
public class cls_tbNHANVIEN_CANBOXETDUYET
{
	public cls_tbNHANVIEN_CANBOXETDUYET()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public static DataTable GetALL()
    {
        av.dal.SqlDataProvider clsSQL = new av.dal.SqlDataProvider();
        DataTable table = new DataTable();
        //SqlParameter[] Parameter = new SqlParameter[1];
        //Parameter[0] = new SqlParameter("@F_MANV", F_MANV);
        try
        {
            //table = clsSQL.GetDataFrom("tbNHANVIEN_GetByF_MANV", CommandType.StoredProcedure, Parameter);
            table = clsSQL.GetDataFrom("tbNHANVIEN_CANBOXETDUYET_GETALL", CommandType.StoredProcedure, null);
        }
        catch /*(Exception ex)*/ { }
        return table;
    }
    public static DataTable GetByF_MACN(string F_MACN)
    {
        av.dal.SqlDataProvider clsSQL = new av.dal.SqlDataProvider();
        DataTable table = new DataTable();
        SqlParameter[] Parameter = new SqlParameter[1];
        Parameter[0] = new SqlParameter("@F_MACN", F_MACN);
        try
        {
            table = clsSQL.GetDataFrom("tbNHANVIEN_CANBOXETDUYET_GETBYF_MACN", CommandType.StoredProcedure, Parameter);
        }
        catch /*(Exception ex)*/ { }
        return table;
    }
    public static DataTable GetByF_MACNF_MANV(string F_MACN, int F_MANV)
    {
        av.dal.SqlDataProvider clsSQL = new av.dal.SqlDataProvider();
        DataTable table = new DataTable();
        SqlParameter[] Parameter = new SqlParameter[2];
        Parameter[0] = new SqlParameter("@F_MACN", F_MACN);
        Parameter[1] = new SqlParameter("@F_MANV", F_MANV);
        try
        {
            table = clsSQL.GetDataFrom("tbNHANVIEN_CANBOXETDUYET_GETBYF_MACNF_MANV", CommandType.StoredProcedure, Parameter);
        }
        catch /*(Exception ex)*/ { }
        return table;
    }
    public static string Insert(string F_MACN, int F_MANV)
    {
        av.dal.SqlDataProvider clsSQL = new av.dal.SqlDataProvider();
        object[] myValue = { F_MACN, F_MANV };
        string[] myPara = { "@F_MACN", "@F_MANV" };
        SqlParameter[] Parameter = new SqlParameter[myPara.Length];
        for (int i = 0; i < myPara.Length; i++)
        {
            Parameter[i] = new SqlParameter(myPara[i], myValue[i]);
        }
        try
        {
            if (clsSQL.ExecuteNonQuery("tbNHANVIEN_CANBOXETDUYET_INSERT", CommandType.StoredProcedure, Parameter) > 0)
                return "OK";
            else
                return "NO";
        }
        catch (SqlException ex) { return ex.Message; }
    }
    public static string Delete(string F_MACN, int F_MANV)
    {
        av.dal.SqlDataProvider clsSQL = new av.dal.SqlDataProvider();
        object[] myValue = { F_MACN, F_MANV };
        string[] myPara = { "@F_MACN", "@F_MANV" };
        SqlParameter[] Parameter = new SqlParameter[myPara.Length];
        for (int i = 0; i < myPara.Length; i++)
        {
            Parameter[i] = new SqlParameter(myPara[i], myValue[i]);
        }
        try
        {
            if (clsSQL.ExecuteNonQuery("tbNHANVIEN_CANBOXETDUYET_DELETE", CommandType.StoredProcedure, Parameter) > 0)
                return "OK";
            else
                return "NO";
        }
        catch (SqlException ex) { return ex.Message; }
    }
}